//
//  MessageModel.m
//  MiniWeChat
//
//  Created by ByteDance on 2025/6/24.
//


#import "MessageModel.h"

@implementation MessageModel

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:self.id forKey:@"id"];
    [coder encodeObject:self.conversation_id forKey:@"conversation_id"];
    [coder encodeInteger:self.type forKey:@"type"];
    [coder encodeObject:self.sender forKey:@"sender"];
    [coder encodeObject:self.content forKey:@"content"];
    [coder encodeObject:self.media_path forKey:@"media_path"];
    [coder encodeInteger:self.media_duration forKey:@"media_duration"];
    [coder encodeInteger:self.media_size forKey:@"media_size"];
    [coder encodeInteger:self.status forKey:@"status"];
    [coder encodeInteger:self.time forKey:@"time"];
}

- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super init];
    if (self) {
        self.id = [coder decodeObjectForKey:@"id"];
        self.conversation_id = [coder decodeObjectForKey:@"conversation_id"];
        self.type = [coder decodeIntegerForKey:@"type"];
        self.sender = [coder decodeObjectForKey:@"sender"];
        self.content = [coder decodeObjectForKey:@"content"];
        self.media_path = [coder decodeObjectForKey:@"media_path"];
        self.media_duration = [coder decodeIntegerForKey:@"media_duration"];
        self.media_size = [coder decodeIntegerForKey:@"media_size"];
        self.status = [coder decodeIntegerForKey:@"status"];
        self.time = [coder decodeIntegerForKey:@"time"];
    }
    return self;
}

@end
